package com.ram.controller;

import com.ram.pojo.AssetInventory;
import com.ram.pojo.Result;
import com.ram.service.AssetInventoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/asset/inventory")
public class AssetInventoryController {
    @Autowired
    private AssetInventoryService inventoryService;

    @GetMapping("/list")
    public Result list() {
        return Result.success(inventoryService.list());
    }

    @GetMapping("/{id}")
    public Result getById(@PathVariable Integer id) {
        return Result.success(inventoryService.getById(id));
    }

    @PostMapping
    public Result add(@RequestBody AssetInventory inventory) {
        inventoryService.add(inventory);
        return Result.success();
    }

    @DeleteMapping("/{id}")
    public Result delete(@PathVariable Integer id) {
        inventoryService.deleteById(id);
        return Result.success();
    }
} 